package erfgame.frontend.desktop.view.terrain.iso;

import java.awt.Point;

import erfgame.core.Point3D;
import erfgame.core.Point3DAndRotation;
import erfgame.core.dao.ObjectDAO;
import erfgame.core.entity.Entity;
import erfgame.core.memory.Pointer;
import erfgame.core.world.World;
import erfgame.core.world.WorldDAO;
import erfgame.core.world.WorldDAOManager;
import erfgame.core.world.terrain.BlockEntityPositions;
import erfgame.core.world.terrain.BlockGridTiles;
import erfgame.core.world.terrain.BlockSurfaceImages;

public class IsometricTerrainViewWorldDAOManagerProxy implements WorldDAOManager {

	private IsometricTerrainView view;
	private WorldDAOManager proxied;
	
	public IsometricTerrainViewWorldDAOManagerProxy(WorldDAOManager proxied) {
		this.proxied = proxied;
	}
	
	public void setView( IsometricTerrainView view ) {
		this.view = view;
	}
	
	public ObjectDAO<Point3DAndRotation, BlockSurfaceImages> getBlockSurfaceImagesDAO(
			World world
	) {
		if( world == view.getCurrentWorld() ) {
			return view;
		} else {
			return proxied.getBlockSurfaceImagesDAO(world);
		}
	}

	public ObjectDAO<Point3D, Pointer<byte[][][]>> getBlockTerrainDAO(World world) {
		return proxied.getBlockTerrainDAO(world);
	}

	public ObjectDAO<Long, Entity> getEntityDAO(World world) {
		return proxied.getEntityDAO(world);
	}

	public ObjectDAO<Point, BlockGridTiles> getGridTilesDAO(World world) {
		return proxied.getGridTilesDAO(world);
	}

	public ObjectDAO<Point, int[][][]> getSurfacesDAO(World world) {
		return proxied.getSurfacesDAO(world);
	}
	
	public ObjectDAO<Point3D, BlockEntityPositions> getBlockEntityPositionsDAO(
			World world) {
		return proxied.getBlockEntityPositionsDAO(world);
	}

	public WorldDAO getWorldDAO() {
		return proxied.getWorldDAO();
	}

}
